//
//  BuyDetailDigitalViewController.m
//  PlayBall
//
//  Created by Edward Zhang on 12-5-8.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "JddBuyDetailDigitalViewController.h"
#import "JddFootBallBuyItemCell.h"
#import "JddBasketBallBuyItemCell.h"
#import "JddBuyDetailViewController.h"
@interface JddBuyDetailDigitalViewController ()

@end

@implementation JddBuyDetailDigitalViewController

@synthesize MoneyLabel;
@synthesize secrectLabel;
@synthesize WinlotNumberLabel;
@synthesize WinMoneyLabel;
@synthesize issueLabel;
@synthesize lotNameLabel;
@synthesize stateLabel;
@synthesize SchemeNumberLabel;
@synthesize StartTimeLabel;
@synthesize realString;
@synthesize WinlotNumberLabel2;
@synthesize winNumHead;
@synthesize myBuyMoney;
@synthesize myWinMoney;
SHARED_VIEW_CONTROLLER_IMPLEMENT(JddBuyDetailDigitalViewController);

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
   // [self.navigationItem setTitle:PAGE_BUY_DETAIL];
    
        UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 30)];
        customLab.backgroundColor = [UIColor clearColor];
        [customLab setText:PAGE_BUY_DETAIL];
        customLab.textAlignment = NSTextAlignmentCenter;

        [customLab setTextColor:[UIColor whiteColor]];
        customLab.font = [UIFont systemFontOfSize:19];
        self.navigationItem.titleView = customLab;
        
//        //self.navigationItem.hidesBackButton = YES;

}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:@"FanAnXiangQing-digital"];
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [MobClick beginLogPageView:@"FanAnXiangQing-digital"];
    [MobClick event:@"UserCenter-touzhujilu-detail"];

    NSDictionary *buydetail = [realString objectFromJSONString];
    //方案内容
    [self addContentViewWithBuydetail:buydetail];
    self.lotNameLabel.text = [buydetail objectForKey:@"LottName"];
    NSString * secrect =[buydetail objectForKey:@"SecState"];
    secrectLabel.text = (([secrect length] <= 1)?@"公开":[buydetail objectForKey:@"SecState"]);
    self.issueLabel.text = [buydetail objectForKey:@"Issue"];
    self.SchemeNumberLabel.text = [buydetail objectForKey:@"SchemeNumber"];
    self.stateLabel.text = [buydetail objectForKey:@"State"];
    myWinMoney.text = [NSString stringWithFormat:@"%@彩豆",[buydetail objectForKey:@"MyWinMoney"]];
    myBuyMoney.text = [NSString stringWithFormat:@"%.2f彩豆",[[buydetail objectForKey:@"MyMoney"] floatValue]];
    self.MoneyLabel.text = [NSString stringWithFormat:@"%@彩豆",[buydetail objectForKey:@"Money"]];
    self.WinMoneyLabel.text = [NSString stringWithFormat:@"%.2f彩豆",[[buydetail objectForKey:@"WinMoney"] floatValue]];
    NSString *string3 = [buydetail objectForKey:@"WinLotNumber"];
    NSArray *array2 = [string3 componentsSeparatedByString:@"+ "];
    NSMutableString *string4 = [array2 objectAtIndex:0];
    if (string3 == nil || [string3 length]==0) {
        self.winNumHead.hidden = YES;
    }
    if ([array2 count]>1) {
        self.WinlotNumberLabel.text = string4;
        self.WinlotNumberLabel2.text = [array2 objectAtIndex:1];
    }else {
        self.WinlotNumberLabel.text = string4;
        self.WinlotNumberLabel2.text = @"";
    }
    
    self.StartTimeLabel.text = [buydetail objectForKey:@"StartTime"]; 
}

//添加方案内容
-(void)addContentViewWithBuydetail:(NSDictionary *)buydetail
{
    JddBuyDetailViewController *contentView = [[JddBuyDetailViewController alloc] init];
    contentView.buydetail = buydetail;
    contentView.parentType = 0;
    [self addChildViewController:contentView];
    [self.contentView addSubview:contentView.view];
}

@end
